package com.house.twohouse.controller;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.house.twohouse.entity.HouseingEntity;
import com.house.twohouse.entity.vo.FlatsVo;
import com.house.twohouse.entity.vo.QueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.house.twohouse.entity.FlatsEntity;
import com.house.twohouse.service.FlatsService;
import com.house.common.utils.PageUtils;
import com.house.common.utils.R;



/**
 * 
 *
 * @author wzh
 * @email sunlightcs@gmail.com
 * @date 2022-04-26 08:13:02
 */
@RestController
@RequestMapping("twohouse/flats")
public class FlatsController {
    @Autowired
    private FlatsService flatsService;



    //查询es列表 根据名字，地区模糊，价格区间 地区id精确 排序
    @RequestMapping("/geteslist")
    public R getesList(@RequestBody QueryVo vo) throws IOException {
        return flatsService.getesList(vo);
    }

    //查询所有的新房
    @RequestMapping("/list")
    public List<FlatsEntity> list(){
        return flatsService.list();
    }



    @RequestMapping("/save")
    public R save(@RequestBody FlatsEntity flatsEntity){
        flatsService.save(flatsEntity);
        return R.ok();
    }
}
